package com.atguigu.yygh.hosp.controller;

import com.atguigu.yygh.common.result.R;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author:ahang
 * @create:2022-08-26 9:51
 * @Description:
 */
@Api(description = "登录接口")
//@CrossOrigin
@RestController
@RequestMapping("/admin/hosp")
public class UserLoginController {

    @PostMapping("/user/login")
    public R login(@RequestBody Map<String,Object> loginVo){
        //校验用户名和密码是否正确

        //响应信息{"code":20000,"data":{"token":"admin-token"}}
        return R.ok().data("token","admin-token");
    }

    @GetMapping("/user/info")
    public R info(){
        //从数据库查询用户信息

        return R.ok().data("roles","admin")
                    .data("introduction","I am a super administrator")
                    .data("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif")
                    .data("name","Super Admin");
    }
}
